package cn.com.twoke.easyproject.config.filter;

import cn.com.twoke.easyproject.common.context.holder.UserLoginContextHolder;
import jakarta.servlet.*;
import org.springframework.stereotype.Component;

import java.io.IOException;

@Component
public class UserLoginContextFilter implements Filter {

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        UserLoginContextHolder.init();
        filterChain.doFilter(servletRequest, servletResponse);
        UserLoginContextHolder.clear();
    }

}
